//
//  Shopping.m
//  SlimmingWar
//
//  Created by ZGS on 12-3-18.
//  Copyright 2012年 110. All rights reserved.
//

#import "Shopping.h"

static NSDictionary* buttons = nil;

typedef enum {
    CapLeft          = 0,
    CapMiddle        = 1,
    CapRight         = 2,
    CapLeftAndRight  = 3
} CapLocation;

@implementation Shopping

-(void)viewDidLoad
{
    [super viewDidLoad];
    
    
    //设置背景
    UIImageView *background = [[UIImageView alloc]initWithFrame:CGRectMake(0, -20, 320, 460)];
    [background setImage:[UIImage imageNamed:@"bg.png"]];
    [self.view addSubview:background];
    [background release];
    
    //设置头像后部背景
    UIImageView *backhead = [[UIImageView alloc]initWithFrame:CGRectMake(30, 0, 260, 330)];
    [backhead setImage:[UIImage imageNamed:@"shop_board.png"]];
    [backhead setAlpha:0.80];
    [self.view addSubview:backhead];
    [backhead release];
    
//    UISegmentedControl *myseg = [[UISegmentedControl alloc]initWithFrame:CGRectMake( 50, 70, 220, 40)];
   
    buttons = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObjects:@"金币", @"虚拟物品", @"实物兑换", nil], @"titles", [NSValue valueWithCGSize:CGSizeMake(80,47)], @"size", @"bottombarblue.png", @"button-image", @"bottombarblue_pressed.png", @"button-highlight-image", @"blue-divider.png", @"divider-image", [NSNumber numberWithFloat:14.0], @"cap-width", nil ];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void) viewDidAppear:(BOOL)animated
{
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    backButton.frame = CGRectMake(0, 0, 30, 20);
    backButton.titleLabel.textColor = [UIColor orangeColor];
    backButton.titleLabel.font = [UIFont systemFontOfSize:12];
    [backButton setTitle:@"返回" forState:UIControlStateNormal];
    [backButton setBackgroundImage:[UIImage imageNamed:@"nav_button.png"] forState:UIControlStateNormal];
    [backButton addTarget:self action:@selector(goBackIndex:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:backButton] autorelease];
}

- (IBAction) goBackIndex:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];

}

- (void)dealloc
{
    [super dealloc];
   
}

@end
